package com.springboot.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.dao.MenuDao;
import com.springboot.domain.Menu;
import com.springboot.domain.MenuOV;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MenuServiceI extends ServiceImpl<MenuDao, Menu> {

    @Autowired
    private MenuDao md;

    public MenuOV pageList(Menu m,Integer current,Integer size){
        QueryWrapper qw = new QueryWrapper();
        MenuOV mov = new MenuOV();
        IPage<Menu> page = new Page<>(current,size);
        md.selectPage(page, qw);
        mov.setCurrent(current);
        mov.setSize(size);
        mov.setTotal(page.getTotal());
        mov.setMenuList(page.getRecords());
        return mov;
    }
}
